package common.Tables;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * class Tasks.
 * represents the Tasks table
 * @author michal
 *
 */
public class Tasks implements Serializable,Table {
	private static final long serialVersionUID = 1L;
	private int id;	//task id
	private String task;	//task name
	private float weight;	//task weight	
	private boolean isDynamicGroup=false;	//true if task is dynamic group
	Set<TasksNotes>	tasksNotes = new HashSet<TasksNotes>();	//set of TasksNotes
	
	/*
	 * getters & setters
	 */
	public Set<TasksNotes> getTasksNotes() {
		return tasksNotes;
	}
	public void setTasksNotes(Set<TasksNotes> tasksNotes) {
		this.tasksNotes = tasksNotes;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTask() {
		return task;
	}
	public void setTask(String task) {
		this.task = task;
	}
	public float getWeight() {
		return weight;
	}
	public void setWeight(float weight) {
		this.weight = weight;
	}
	/**
	 * c-tor using fields
	 * @param taskName
	 * @param weight
	 */
	public Tasks(String taskName,float weight){
		this.task=taskName;
		this.weight=weight;
	}
	/**
	 * default c-tor
	 */
	public Tasks(){
		
	}
	/**
	 * c-tor using fields
	 * @param taskName
	 * @param weight
	 * @param isDynamicGroup
	 */
	public Tasks(String taskName, float weight, boolean isDynamicGroup) {
		this.task=taskName;
		this.weight=weight;
		this.isDynamicGroup = isDynamicGroup;
		
	}
	public String toString(){
		return "ID: "+id+" name: "+task+" weight: "+weight;
	}
	
	public boolean equals(Tasks task2){
		if (this.getId()==task2.getId())
			return true;
		else return false;
	}	
	
	//-----------private funciton to dynamic grouping----------------//
	public void setDynamicGroup(boolean isDynamicGroup) {
		this.isDynamicGroup = isDynamicGroup;
	}
	public boolean isDynamicGroup() {
		return isDynamicGroup;
	}
}
